package org.deschutter.hibernate;

import javax.persistence.*;

/**
 * User: Berten De Schutter
 * Date: 01-Oct-2009
 * Time: 13:38:48
 */
@Entity
@Table(catalog = "scimitar", name = "news")
public class News {
    private long id;

    @Id
    @Column(name = "ID")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    private int tickId;

    @Basic
    @Column(name = "tick_id")
    public int getTickId() {
        return tickId;
    }

    public void setTickId(int tickId) {
        this.tickId = tickId;
    }

    private int landId;

    @Basic
    @Column(name = "land_id")
    public int getLandId() {
        return landId;
    }

    public void setLandId(int landId) {
        this.landId = landId;
    }

    private String x;

    @Basic
    @Column(name = "x")
    public String getX() {
        return x;
    }

    public void setX(String x) {
        this.x = x;
    }

    private String y;

    @Basic
    @Column(name = "y")
    public String getY() {
        return y;
    }

    public void setY(String y) {
        this.y = y;
    }

    private String z;

    @Basic
    @Column(name = "z")
    public String getZ() {
        return z;
    }

    public void setZ(String z) {
        this.z = z;
    }

    private int amount;

    @Basic
    @Column(name = "amount")
    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        News news = (News) o;

        if (amount != news.amount) return false;
        if (id != news.id) return false;
        if (landId != news.landId) return false;
        if (tickId != news.tickId) return false;
        if (x != null ? !x.equals(news.x) : news.x != null) return false;
        if (y != null ? !y.equals(news.y) : news.y != null) return false;
        if (z != null ? !z.equals(news.z) : news.z != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + tickId;
        result = 31 * result + landId;
        result = 31 * result + (x != null ? x.hashCode() : 0);
        result = 31 * result + (y != null ? y.hashCode() : 0);
        result = 31 * result + (z != null ? z.hashCode() : 0);
        result = 31 * result + amount;
        return result;
    }

    private Scans scansByScanId;

    @ManyToOne
    @JoinColumn(name = "scan_id", referencedColumnName = "ID", nullable = false)
    public Scans getScansByScanId() {
        return scansByScanId;
    }

    public void setScansByScanId(Scans scansByScanId) {
        this.scansByScanId = scansByScanId;
    }

    private NewsScanType newsScanTypeByTypeId;

    @ManyToOne
    @JoinColumn(name = "type_id", referencedColumnName = "ID", nullable = false)
    public NewsScanType getNewsScanTypeByTypeId() {
        return newsScanTypeByTypeId;
    }

    public void setNewsScanTypeByTypeId(NewsScanType newsScanTypeByTypeId) {
        this.newsScanTypeByTypeId = newsScanTypeByTypeId;
    }
}
